package com.atguigu.springcloud;

import com.atguigu.myrule.MySelfRule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.core.env.Environment;

/**
 * @Auther:
 * @Description:
 * @Date: 2019/11/19 15:45
 */
@SpringBootApplication
@EnableEurekaClient
// 在启动改服务的时候就能去加载我们的自定义Ribbon配置类，从而使配置生效
@RibbonClient(name = "MICROSERVICECLOUD-DEPT", configuration = MySelfRule.class)
public class DeptConsumer80_App {
    private static final Logger logger = LoggerFactory.getLogger(DeptConsumer80_App.class);
    public static void main(String[] args) {
        Environment environment = SpringApplication.run(DeptConsumer80_App.class).getEnvironment();
        logger.info("\n http://localhost:{}/consumer/dept/list", environment.getProperty("server.port"));
    }
}
